package com.qiantu.api.entity;

import java.io.Serializable;
import java.util.Objects;

public class DeviceState  implements Serializable {

    private String devid;
    private Integer pos;
    private Integer grp;
    public StatusDTO status;
    public SettingDTO settings;
    private AttrDTO attr;
    private String upDateTime;

    public String getDevid() {
        return devid;
    }

    public void setDevid(String devid) {
        this.devid = devid;
    }

    public Integer getPos() {
        return pos;
    }

    public void setPos(Integer pos) {
        this.pos = pos;
    }

    public Integer getGrp() {
        return grp;
    }

    public void setGrp(Integer grp) {
        this.grp = grp;
    }

    public StatusDTO getStatus() {
        if(status ==null){
            status = new StatusDTO(1);
        }
        return status;
    }

    public void setStatus(StatusDTO status) {
        this.status = status;
    }

    public SettingDTO getSettings() {
        return settings;
    }

    public void setSettings(SettingDTO settings) {
        this.settings = settings;
    }

    public AttrDTO getAttr() {
        return attr;
    }

    public void setAttr(AttrDTO attr) {
        this.attr = attr;
    }

    public String getUpDateTime() {
        return upDateTime;
    }

    public void setUpDateTime(String upDateTime) {
        this.upDateTime = upDateTime;
    }

    public static class StatusDTO  implements Serializable{
        private Integer online = -1;//在线状态 1在线 0离线
        private Integer power = 0;//开关状态 1开 0关
        private Integer trigger = 0;//是否触发 1触发
        private Integer light = 0;//亮度值（百分比）
        private Integer strokestate = 0; //行程状态 2-上升(开) 1-下降(合) 3-暂停
        private Integer strokepercentage = 0; //行程百分比 0-100
        private Integer angle = 0;
        private Integer kelvin = 0;//色温值
        private Integer red = 0;//红
        private Integer green = 0;//绿
        private Integer blue = 0;//蓝
        private Integer mode = 0;//模式
        private Integer windspeed = 0;//风速
        private Integer winddirection = 0;//风向
        private Integer exhaustspeed = 0;//排风速
        private Integer temperature = 0;//温度
        private Integer humidity = 0;//温度
        private Integer illuminance = 0;//温度
        private Integer pm2_5 = 0;//温度
        private Integer noise = 0;//温度
        private Integer lock = 0;//0:解锁 1:半锁定 2:锁定
        private Integer ambienttemperature = 0; //环境温度
        private Integer irctrl;
        private Integer wirelessctrl_433;
        private Integer wirelessctrl_315;
        private Integer progress = 0; //当前播放进度
        private Integer length = 0; //歌曲长度
        private String songpicurl; //歌曲封面图片地址
        private String lyricurl; //歌词地址
        private String songauth; //作者
        private String songname; //歌曲名称
        private Integer playmode = 0; //播放模式  2:单曲循环 5:随机  6:全部
        private String songid; //歌曲编号
        private Integer volume = 0; //音量
        private Integer playstate = 0; //音乐状态
        private String sheetid; //当前歌单编号
        private Integer next = 0; //切歌
        private Integer key_operate = 0; //切歌

        public StatusDTO(){}

        public StatusDTO(int type){
            online = null;//在线状态 1在线 0离线
            power = null;
            trigger = null;
            light = null;
            strokestate = null;
            strokepercentage = null;
            angle = null;
            kelvin = null;
            mode = null;
            windspeed = null;
            winddirection = null;
            exhaustspeed = null;
            temperature = null;
            lock = null;
            ambienttemperature = null;
        }

        public Integer getOnline() {
            return online;
        }

        public void setOnline(Integer online) {
            this.online = online;
        }

        public Integer getPower() {
            return power;
        }

        public void setPower(Integer power) {
            this.power = power;
        }

        public Integer getLight() {
            return light;
        }

        public void setLight(Integer light) {
            this.light = light;
        }

        public Integer getStrokestate() {
            return strokestate;
        }

        public void setStrokestate(Integer strokestate) {
            this.strokestate = strokestate;
        }

        public Integer getStrokepercentage() {
            return strokepercentage;
        }

        public void setStrokepercentage(Integer strokepercentage) {
            this.strokepercentage = strokepercentage;
        }

        public Integer getAngle() {
            return angle;
        }

        public void setAngle(Integer angle) {
            this.angle = angle;
        }

        public Integer getKelvin() {
            return kelvin;
        }

        public void setKelvin(Integer kelvin) {
            this.kelvin = kelvin;
        }

        public Integer getRed() {
            return red;
        }

        public void setRed(Integer red) {
            this.red = red;
        }

        public Integer getGreen() {
            return green;
        }

        public void setGreen(Integer green) {
            this.green = green;
        }

        public Integer getBlue() {
            return blue;
        }

        public void setBlue(Integer blue) {
            this.blue = blue;
        }

        public Integer getMode() {
            return mode;
        }

        public void setMode(Integer mode) {
            this.mode = mode;
        }

        public Integer getWindspeed() {
            return windspeed;
        }

        public void setWindspeed(Integer windspeed) {
            this.windspeed = windspeed;
        }

        public Integer getWinddirection() {
            return winddirection;
        }

        public void setWinddirection(Integer winddirection) {
            this.winddirection = winddirection;
        }

        public Integer getExhaustspeed() {
            return exhaustspeed;
        }

        public void setExhaustspeed(Integer exhaustspeed) {
            this.exhaustspeed = exhaustspeed;
        }

        public Integer getTemperature() {
            return temperature;
        }

        public void setTemperature(Integer temperature) {
            this.temperature = temperature;
        }

        public Integer getHumidity() {
            return humidity;
        }

        public void setHumidity(Integer humidity) {
            this.humidity = humidity;
        }

        public Integer getIlluminance() {
            return illuminance;
        }

        public void setIlluminance(Integer illuminance) {
            this.illuminance = illuminance;
        }

        public Integer getPm2_5() {
            return pm2_5;
        }

        public void setPm2_5(Integer pm2_5) {
            this.pm2_5 = pm2_5;
        }

        public Integer getNoise() {
            return noise;
        }

        public void setNoise(Integer noise) {
            this.noise = noise;
        }

        public Integer getTrigger() {
            return trigger;
        }

        public void setTrigger(Integer trigger) {
            this.trigger = trigger;
        }

        public Integer getLock() {
            return lock;
        }

        public void setLock(Integer lock) {
            this.lock = lock;
        }

        public Integer getAmbienttemperature() {
            return ambienttemperature;
        }

        public void setAmbienttemperature(Integer ambienttemperature) {
            this.ambienttemperature = ambienttemperature;
        }

        public Integer getIrctrl() {
            return irctrl;
        }

        public void setIrctrl(Integer irctrl) {
            this.irctrl = irctrl;
        }

        public Integer getWirelessctrl_433() {
            return wirelessctrl_433;
        }

        public void setWirelessctrl_433(Integer wirelessctrl_433) {
            this.wirelessctrl_433 = wirelessctrl_433;
        }

        public Integer getWirelessctrl_315() {
            return wirelessctrl_315;
        }

        public void setWirelessctrl_315(Integer wirelessctrl_315) {
            this.wirelessctrl_315 = wirelessctrl_315;
        }

        public Integer getProgress() {
            return progress;
        }

        public void setProgress(Integer progress) {
            this.progress = progress;
        }

        public Integer getLength() {
            return length;
        }

        public void setLength(Integer length) {
            this.length = length;
        }

        public String getSongpicurl() {
            return songpicurl;
        }

        public void setSongpicurl(String songpicurl) {
            this.songpicurl = songpicurl;
        }

        public String getLyricurl() {
            return lyricurl;
        }

        public void setLyricurl(String lyricurl) {
            this.lyricurl = lyricurl;
        }

        public String getSongauth() {
            return songauth;
        }

        public void setSongauth(String songauth) {
            this.songauth = songauth;
        }

        public String getSongname() {
            return songname;
        }

        public void setSongname(String songname) {
            this.songname = songname;
        }

        public Integer getPlaymode() {
            return playmode;
        }

        public void setPlaymode(Integer playmode) {
            this.playmode = playmode;
        }

        public String getSongid() {
            return songid;
        }

        public void setSongid(String songid) {
            this.songid = songid;
        }

        public Integer getVolume() {
            return volume;
        }

        public void setVolume(Integer volume) {
            this.volume = volume;
        }

        public Integer getPlaystate() {
            return playstate;
        }

        public void setPlaystate(Integer playstate) {
            this.playstate = playstate;
        }

        public String getSheetid() {
            return sheetid;
        }

        public void setSheetid(String sheetid) {
            this.sheetid = sheetid;
        }

        public Integer getNext() {
            return next;
        }

        public void setNext(Integer next) {
            this.next = next;
        }

        public Integer getKey_operate() {
            return key_operate;
        }

        public void setKey_operate(Integer key_operate) {
            this.key_operate = key_operate;
        }

        public boolean homeDeviceEquals(StatusDTO o) {
            if (o == null) return false;
            //online不判断，因为设备的在线是根据online和device的stateType共同判断的
            return Objects.equals(power, o.power) &&
                    Objects.equals(light, o.light) &&
                    Objects.equals(strokepercentage, o.strokepercentage) &&
                    Objects.equals(mode, o.mode) &&
                    Objects.equals(windspeed, o.windspeed) &&
                    Objects.equals(temperature, o.temperature) &&
                    Objects.equals(trigger,o.trigger);
        }

        public boolean deviceEquals(StatusDTO o) {
            if (o == null) return false;
            //online不判断，因为设备的在线是根据online和device的stateType共同判断的
            return Objects.equals(power, o.power) &&
                    Objects.equals(trigger, o.trigger) &&
                    Objects.equals(light, o.light) &&
                    Objects.equals(strokestate, o.strokestate) &&
                    Objects.equals(strokepercentage, o.strokepercentage) &&
                    Objects.equals(kelvin, o.kelvin) &&
                    Objects.equals(mode, o.mode) &&
                    Objects.equals(windspeed, o.windspeed) &&
                    Objects.equals(winddirection, o.winddirection) &&
                    Objects.equals(exhaustspeed, o.exhaustspeed) &&
                    Objects.equals(temperature, o.temperature) &&
                    Objects.equals(lock, o.lock) &&
                    Objects.equals(ambienttemperature, o.ambienttemperature) &&
                    Objects.equals(irctrl, o.irctrl) &&
                    Objects.equals(wirelessctrl_433, o.wirelessctrl_433) &&
                    Objects.equals(progress, o.progress) &&
                    Objects.equals(length, o.length) &&
                    Objects.equals(songpicurl, o.songpicurl) &&
                    Objects.equals(lyricurl, o.lyricurl) &&
                    Objects.equals(songauth, o.songauth) &&
                    Objects.equals(songname, o.songname) &&
                    Objects.equals(playmode, o.playmode) &&
                    Objects.equals(songid, o.songid) &&
                    Objects.equals(volume, o.volume) &&
                    Objects.equals(playstate, o.playstate) &&
                    Objects.equals(sheetid, o.sheetid) &&
                    Objects.equals(next, o.next) &&
                    Objects.equals(key_operate, o.key_operate) &&
                    Objects.equals(angle, o.angle) &&
                    Objects.equals(angle, o.angle);
        }
    }

    public static class SettingDTO  implements Serializable{
        private Integer cm_result = -1;
        private Float period;
        private Integer sensitivity;
        /**
         * 传感类型设置
         * 1-红外感应 2-红外对射 3-门磁 4-有毒气体 5-振动传感 6-红外幕布 7-烟雾警报 8-触发开关 9-警报开关 10-人体感应
         */
        private Integer triggertype;
        /**
         * 传感器触发类型
         * 0-高电平 2-PWM
         */
        private Integer sensortriggtype;

        /**
         *指示灯设置
         * 0-关闭指示 1-开启指示灯 255-恢复出厂设置
         */
        private Integer instructsetting;

        /**
         * 区间上界 区间下界
         */
        private Integer upperbound;
        private Integer lowerbound;
        private Integer doorcontactmode;
        private double calibrationvalue;
        private double radius;

        public Integer getCm_result() {
            return cm_result;
        }

        public void setCm_result(Integer cm_result) {
            this.cm_result = cm_result;
        }

        public Float getPeriod() {
            return period;
        }

        public void setPeriod(Float period) {
            this.period = period;
        }

        public Integer getSensitivity() {
            return sensitivity;
        }

        public void setSensitivity(Integer sensitivity) {
            this.sensitivity = sensitivity;
        }

        public Integer getTriggertype() {
            return triggertype;
        }

        public void setTriggertype(Integer triggertype) {
            this.triggertype = triggertype;
        }

        public Integer getSensortriggtype() {
            return sensortriggtype;
        }

        public void setSensortriggtype(Integer sensortriggtype) {
            this.sensortriggtype = sensortriggtype;
        }

        public Integer getInstructsetting() {
            return instructsetting;
        }

        public void setInstructsetting(Integer instructsetting) {
            this.instructsetting = instructsetting;
        }

        public Integer getUpperbound() {
            return upperbound;
        }

        public void setUpperbound(Integer upperbound) {
            this.upperbound = upperbound;
        }

        public Integer getLowerbound() {
            return lowerbound;
        }

        public void setLowerbound(Integer lowerbound) {
            this.lowerbound = lowerbound;
        }

        public Integer getDoorcontactmode() {
            return doorcontactmode;
        }

        public void setDoorcontactmode(Integer doorcontactmode) {
            this.doorcontactmode = doorcontactmode;
        }

        public double getCalibrationvalue() {
            return calibrationvalue;
        }

        public void setCalibrationvalue(double calibrationvalue) {
            this.calibrationvalue = calibrationvalue;
        }

        public double getRadius() {
            return radius;
        }

        public void setRadius(double radius) {
            this.radius = radius;
        }
    }

    public static class AttrDTO  implements Serializable{
        private int period;

        public int getPeriod() {
            return period;
        }

        public void setPeriod(int period) {
            this.period = period;
        }
    }
}
